import React, {useEffect, useState} from "react";
import {Text, View} from 'react-native'
import { NavBar } from "@fruits-chain/react-native-xiaoshu";
import { homeApi,Home } from "../../../api";


export default ({route}) => {
  const { id } = route.params
  console.log("id", id);
  useEffect(() => {
    getArticleInfo()
  }, [])
  
  const [articleInfo, setArticleInfo] = useState<Home.ArticleInfo>()
  const getArticleInfo = async () => {
    const res = await homeApi.getArticleInfoApi(id)
    console.log("res", res);
    setArticleInfo(res.data)
  }

  return (
    <View>
        <NavBar
          title="一般使用"
          onPressBackArrow={() => {
            console.log('点击返回')
          }}
        />
      <Text>{articleInfo?.article_title}</Text>
      <Text>{articleInfo?.article_info}</Text>
    </View>
  )
}